//统一管理项目地址
import fetch from "./fetch";
//导入的node.js组件方法
import qs from "qs";
import request from "./request";

//请求游记推荐数据
export const ApiTravelsData = () => fetch("/index/banners/travel");
//请求首页旅游日记数据
export const ApiTravelDiaryData = (
  orderType,
  currentPage,
  perExpendType = 0,
  dayType = 0
) =>
  fetch(
    `/travels/query?orderType=${orderType}&currentPage=${currentPage}&perExpendType=${perExpendType}&dayType=${dayType}`
  );
//登录请求
export const ApiLogin = (params) =>
  fetch("/users/login", qs.stringify(params), "POST");
//检查手机号是否注册
export const ApiCheckPhone = (params) =>
  fetch(`/users/checkPhone?phone=${params.phone}`);
// 检查手机号是否注册
// export const ApiCheckPhone= (params) => request.get('/users/checkPhone', { params })
//发送验证码
export const ApiSendVerifyCode = (params) =>
  fetch("/users/sendVerifyCode", qs.stringify(params), "POST");
//用户注册
export const ApiRegist = (params) =>
  fetch("/users/regist", qs.stringify(params), "POST");
//热门地区
export const ApiDestinations = () => fetch("/destinations/hotRegion");
//查询地区内的目的地
export const ApiSearch = (regionId) =>
  fetch(`/destinations/search?regionId=${regionId}`);
//查询目的地详情页面
export const ApiDestinationsToasts = (destId) =>
  fetch(`/destinations/toasts?destId=${destId}`);
//攻略主题
export const ApiStrategies = () => fetch("/strategies/themes");
//攻略列表
export const ApiStrategiesQuery = (themeId, currentPage) =>
  fetch(`/strategies/query?themeId=${themeId}&currentPage=${currentPage}`);
//攻略详情
export const ApiStrategiesDetail = (id) => fetch(`/strategies/detail?id=${id}`);
//游记详情
export const ApiTravelsDetail = (id) => fetch(`/travels/detail?id=${id}`);
